home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / Clueless.swf / scripts / Partner.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  3.4 KB  |  133 lines

  1. package
  2. {
  3.    import flash.utils.Dictionary;
  4.    
  5.    public class Partner
  6.    {
  7.        
  8.       
  9.       internal var _aLikeTexts:Array;
  10.       
  11.       public var TargetName:String = "";
  12.       
  13.       public var AttributeMatchMinimum:int = 3;
  14.       
  15.       public var ImageName:String = "";
  16.       
  17.       public var Name:String = "";
  18.       
  19.       public var Index:int;
  20.       
  21.       public var HintText:String = "";
  22.       
  23.       public var Attributes:Array;
  24.       
  25.       public var TargetModel:String = "";
  26.       
  27.       public function Partner()
  28.       {
  29.          Name = "";
  30.          HintText = "";
  31.          Attributes = new Array();
  32.          ImageName = "";
  33.          TargetModel = "";
  34.          TargetName = "";
  35.          AttributeMatchMinimum = 3;
  36.          _aLikeTexts = new Array();
  37.          super();
  38.       }
  39.       
  40.       public function getLikeTextForIndex(param1:int) : String
  41.       {
  42.          return _aLikeTexts[param1] as String;
  43.       }
  44.       
  45.       public function isSkipAttribute(param1:String) : Boolean
  46.       {
  47.          if(param1 == "long" || param1 == "medium" || param1 == "short")
  48.          {
  49.             return true;
  50.          }
  51.          return false;
  52.       }
  53.       
  54.       public function getLikeText() : String
  55.       {
  56.          var _loc1_:int = 0;
  57.          _loc1_ = Math.random() * _aLikeTexts.length;
  58.          trace("Like text " + _loc1_.toString() + " of " + _aLikeTexts.length);
  59.          return _aLikeTexts[_loc1_] as String;
  60.       }
  61.       
  62.       public function getNumLikeTexts() : int
  63.       {
  64.          return _aLikeTexts.length;
  65.       }
  66.       
  67.       public function addLikeText(param1:String) : void
  68.       {
  69.          _aLikeTexts.push(param1);
  70.       }
  71.       
  72.       public function likesList(param1:DressupModel) : Array
  73.       {
  74.          var _loc2_:Array = null;
  75.          var _loc3_:Dictionary = null;
  76.          var _loc4_:String = null;
  77.          var _loc5_:Part = null;
  78.          var _loc6_:String = null;
  79.          _loc2_ = new Array();
  80.          _loc3_ = new Dictionary();
  81.          for each(_loc4_ in ["top","bottom","shoe"])
  82.          {
  83.             if((_loc5_ = param1.getPart(_loc4_)) != null)
  84.             {
  85.                for each(_loc6_ in Attributes)
  86.                {
  87.                   if(_loc5_.Template.hasAttribute(_loc6_))
  88.                   {
  89.                      if(!(_loc4_ == "shoe" && isSkipAttribute(_loc6_)))
  90.                      {
  91.                         _loc3_[_loc6_] = _loc6_;
  92.                      }
  93.                   }
  94.                }
  95.             }
  96.          }
  97.          for each(_loc6_ in _loc3_)
  98.          {
  99.             _loc2_.push(_loc6_);
  100.          }
  101.          return _loc2_;
  102.       }
  103.       
  104.       public function likes(param1:DressupModel) : Boolean
  105.       {
  106.          var _loc2_:int = 0;
  107.          var _loc3_:String = null;
  108.          var _loc4_:Part = null;
  109.          var _loc5_:String = null;
  110.          _loc2_ = 0;
  111.          for each(_loc3_ in ["top","bottom"])
  112.          {
  113.             if((_loc4_ = param1.getPart("top")) == null)
  114.             {
  115.                return false;
  116.             }
  117.             for each(_loc5_ in Attributes)
  118.             {
  119.                if(_loc4_.Template.hasAttribute(_loc5_))
  120.                {
  121.                   _loc2_++;
  122.                }
  123.             }
  124.             if(_loc2_ < AttributeMatchMinimum)
  125.             {
  126.                return false;
  127.             }
  128.          }
  129.          return true;
  130.       }
  131.    }
  132. }
  133.